home *** CD-ROM | disk | FTP | other *** search
/ Champak 48 / cdrom_image.iso / Games / rollerrush / game.dcr / Waitress_310_draw text.ls < prev    next >
Encoding:
Text File  |  2007-10-01  |  4.2 KB  |  137 lines

  1. on DrawTip tip, pt
  2.   pt = pt + point(5, 40)
  3.   sendSprite(437, #turnOff)
  4.   imgWidth = 55
  5.   imgHeight = 15
  6.   CreateTextImage(84, "fonts", imgWidth, imgHeight, "tiptext")
  7.   pt1 = "+" & string(tip)
  8.   DrawText(84, "fonts", pt1, 1, "y", 0, 0)
  9.   firstx = pt1.char.count * 8
  10.   img = member(84, "fonts").image
  11.   mem1 = 160
  12.   srcRect = member(mem1, "fonts").rect
  13.   dstRect = rect(firstx, 0, firstx + srcRect.right, 0 + srcRect.bottom)
  14.   img.copyPixels(member(mem1, "fonts").image, dstRect, srcRect)
  15.   sendSprite(437, #turnOn, pt)
  16. end
  17.  
  18. on DrawLose tip, pt
  19.   tip = abs(tip)
  20.   if sendSprite(438, #getGoing) = 0 then
  21.     wha = 1
  22.   else
  23.     if sendSprite(439, #getGoing) = 0 then
  24.       wha = 2
  25.     else
  26.       wha = 3
  27.       sendSprite(440, #turnOff)
  28.     end if
  29.   end if
  30.   imgWidth = 70
  31.   imgHeight = 30
  32.   CreateTextImage(87 + wha, "fonts", imgWidth, imgHeight, "losttext")
  33.   pt1 = "-" & string(tip)
  34.   DrawText(87 + wha, "fonts", pt1, 1, "r", 10, 15)
  35.   img = member(87 + wha, "fonts").image
  36.   mem1 = 58
  37.   srcRect = member(mem1, "fonts").rect
  38.   dstRect = rect(0, 0, 0 + srcRect.right, 0 + srcRect.bottom)
  39.   img.copyPixels(member(mem1, "fonts").image, dstRect, srcRect)
  40.   sendSprite(437 + wha, #turnOn, pt)
  41. end
  42.  
  43. on DrawColorText mList, pt
  44.   c = mList.count
  45.   yo = 0
  46.   sendSprite(436, #turnOff)
  47.   imgWidth = 100
  48.   imgHeight = 15 * c
  49.   CreateTextImage(83, "fonts", imgWidth, imgHeight, "colortext")
  50.   img = member(83, "fonts").image
  51.   repeat with b = 1 to c
  52.     yo = 15 * (b - 1)
  53.     pt1 = "+" & string(mList[b].sco)
  54.     DrawText(83, "fonts", pt1, 1, "y", 0, yo)
  55.     firstx = pt1.char.count * 8
  56.     mem1 = mList[b].colo + 171
  57.     srcRect = member(mem1, "fonts").rect
  58.     dstRect = rect(firstx, yo, firstx + srcRect.right, yo + srcRect.bottom)
  59.     img.copyPixels(member(mem1, "fonts").image, dstRect, srcRect)
  60.     oxx = dstRect.right
  61.     mem3 = "multX"
  62.     srcRect = member(mem3, "fonts").rect
  63.     dstRect = rect(oxx, yo, oxx + srcRect.right, yo + srcRect.bottom)
  64.     img.copyPixels(member(mem3, "fonts").image, dstRect, srcRect)
  65.     mem2 = "small" & string(mList[b].mult)
  66.     srcRect = member(mem2, "fonts").rect
  67.     dstRect = rect(oxx + 10, yo, oxx + 10 + srcRect.right, yo + srcRect.bottom)
  68.     img.copyPixels(member(mem2, "fonts").image, dstRect, srcRect)
  69.   end repeat
  70.   sendSprite(436, #turnOn, pt)
  71. end
  72.  
  73. on DrawScoreText action, mult, sco, special, pt
  74.   pt = pt + point(45, 20)
  75.   sendSprite(435, #turnOff)
  76.   imgHeight = 39
  77.   imgWidth = 100
  78.   line1 = "+" & string(sco)
  79.   line2 = action && "x" && string(mult)
  80.   l1c = line1.char.count
  81.   l2c = line2.char.count
  82.   mem = 82
  83.   castd = "fonts"
  84.   CreateTextImage(mem, castd, imgWidth, imgHeight, "bonusText")
  85.   DrawText(mem, castd, line1, 1, "z", 0, 13)
  86.   img = member(mem, castd).image
  87.   mem1 = action & "-txt"
  88.   srcRect = member(mem1, "fonts").rect
  89.   dstRect = rect(0, 0, srcRect.right, 0 + srcRect.bottom)
  90.   img.copyPixels(member(mem1, "fonts").image, dstRect, srcRect)
  91.   oxx = srcRect.right
  92.   mem3 = "multX"
  93.   srcRect = member(mem3, "fonts").rect
  94.   dstRect = rect(oxx, 0, oxx + srcRect.right, 0 + srcRect.bottom)
  95.   img.copyPixels(member(mem3, "fonts").image, dstRect, srcRect)
  96.   mem2 = "small" & string(mult)
  97.   srcRect = member(mem2, "fonts").rect
  98.   dstRect = rect(oxx + 10, 0, oxx + 10 + srcRect.right, 0 + srcRect.bottom)
  99.   img.copyPixels(member(mem2, "fonts").image, dstRect, srcRect)
  100.   sendSprite(435, #turnOn, pt)
  101. end
  102.  
  103. on DrawText mem, castd, txt, lin, big, xo, yo
  104.   if txt = EMPTY then
  105.     return 
  106.   end if
  107.   c = txt.char.count
  108.   img = member(mem, castd).image
  109.   repeat with b = 1 to c
  110.     chr = txt.char[b]
  111.     if chr = " " then
  112.       xo = xo + 20
  113.       next repeat
  114.     end if
  115.     mem1 = big & chr
  116.     srcRect = member(mem1, "fonts").rect
  117.     dstRect = rect(xo, yo, xo + srcRect.right, yo + srcRect.bottom)
  118.     img.copyPixels(member(mem1, "fonts").image, dstRect, srcRect)
  119.     if (big = "z") or (big = "r") then
  120.       xo = xo + srcRect.right
  121.       next repeat
  122.     end if
  123.     if big = "y" then
  124.       xo = xo + srcRect.right - 3
  125.     end if
  126.   end repeat
  127. end
  128.  
  129. on CreateTextImage mem, castd, wid, hei, nam
  130.   member(mem, castd).erase()
  131.   new(#bitmap, member(mem, castd))
  132.   member(mem, castd).image = image(wid, hei, 32)
  133.   member(mem, castd).name = nam
  134.   member(mem, castd).useAlpha = 1
  135.   member(mem, castd).image.fill(0, 0, wid, hei, rgb(255, 255, 255))
  136. end
  137.